#include <iostream>
#include <jsoncpp/json/json.h>
#include <openssl/ssl.h>
#include <sstream>
#include <memory>
#include <locale> // 添加 locale 头文件


int main()
{
    
    std::locale::global(std::locale("en_US.UTF-8"));
    std::cout.imbue(std::locale("en_US.UTF-8"));
    const char* name = "张三";
    int age = 18;
    float score[] = {77, 82.4, 93};
    
    Json::Value root;
    root["姓名"] = name;
    root["年龄"] = age;
    root["成绩"].append(score[0]);  
    root["成绩"].append(score[1]);  
    root["成绩"].append(score[2]);

    Json::StreamWriterBuilder swb;
    Json::Value def;
    def["emitUTF8"] = false;
    swb.setDefaults(&def);

    std::unique_ptr<Json::StreamWriter> sw(swb.newStreamWriter());
    std::stringstream ss;
    sw->write(root, &ss);
    std::cout << ss.str() << std::endl;  

    return 0;
}
